#include "replyOpt.h"
#include "my_link.h"

static int link_loop_find(int *cfd_arr)
{
    int n = 0;

    node *p = H->head->next;

    while (NULL != p)
    {
        if (p->data->id[0] == 16)
        {
            cfd_arr[n++] = p->data->id[1];
        }
        p = p->next;
    }

    return n;
}

void replyOpt(const struct Pack const *pack)
{
    int cfd_arr[32] = {0};

    int n = link_loop_find(cfd_arr);

    while (n--)
    {
        send(cfd_arr[n], pack, sizeof(struct Pack), 0);
    }
}
